package com.cloudsea.yunhaistores.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

@Data
@Schema(description = "用户提交购物车以创建订单的请求DTO")
public class SubmitOrderDTO {

    @NotBlank(message = "会话ID不能为空")
    @Schema(description = "当前点餐的会话ID (通过/sessions/start接口获取)", requiredMode = Schema.RequiredMode.REQUIRED)
    private String sessionId;

    @NotBlank(message = "订单类型不能为空")
    @Schema(description = "订单类型: DINE_IN(堂食) 或 DELIVERY(外卖)", requiredMode = Schema.RequiredMode.REQUIRED, example = "DINE_IN")
    private String orderType;

    @Schema(description = "配送地址，当orderType为'DELIVERY'时必须提供")
    private AddressInfo deliveryAddress;

    @Schema(description = "订单备注", example = "全部免辣，谢谢！")
    private String remarks;

    // 内部类，用于描述地址信息
    @Data
    @Schema(description = "配送地址信息")
    public static class AddressInfo {
        @NotBlank(message = "收货人姓名不能为空")
        private String recipientName;
        @NotBlank(message = "收货人手机号不能为空")
        private String phoneNumber;
        @NotBlank(message = "省份不能为空")
        private String province;
        @NotBlank(message = "城市不能为空")
        private String city;
        @NotBlank(message = "区/县不能为空")
        private String district;
        @NotBlank(message = "详细地址不能为空")
        private String detail;
    }
}